<template>
  <div style="padding: 10px; width: 100%;text-align:center">
    
      <el-card style="width: 800px; height: 500px;">
      <div>
       <el-form :model="form" ref="form">
        <el-row>
          <el-col span="12">
            <el-form-item label="教工号" prop="stuId" label-width="100px">
              <el-input v-model="form.tid" placeholder="请输入学号" :disabled="true"/>
            </el-form-item>
          </el-col>
          <el-col span="12">
            <el-form-item label="姓名" prop="stuName" label-width="100px">
              <el-input v-model="form.tname" placeholder="请输入姓名" :disabled="true"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col span="24">
            <el-form-item label="性别" prop="sex" label-width="100px">
              <el-input v-model="form.sex" placeholder="请输入姓名" :disabled="true"/>
            </el-form-item>
          </el-col>
          
        </el-row>
        <el-row >
          <el-col span="8" >
            <el-form-item label="年级" prop="gradeId" label-width="100px" >
                <el-tag size="medium" style="width:100px">{{g1}}</el-tag>
            </el-form-item>
          </el-col>
          <el-col span="8">
            <el-form-item label="班级" prop="clazzId" label-width="100px">
              <el-tag size="medium" style="width:100px">{{clazzName}}</el-tag>
            </el-form-item>
          </el-col>
          <el-col span="8">
            <el-form-item label="课程" prop="clazzId" label-width="100px">
              <el-tag size="medium" style="width:100px">{{courseName}}</el-tag>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row >
          <el-col span="8" >
            <el-form-item label="年级" prop="gradeId" label-width="100px" >
                <el-tag size="medium" style="width:100px">{{gradeName1}}</el-tag>
            </el-form-item>
          </el-col>
          <el-col span="8">
            <el-form-item label="班级" prop="clazzId" label-width="100px">
              <el-tag size="medium" style="width:100px">{{clazzName1}}</el-tag>
            </el-form-item>
          </el-col>
          <el-col span="8">
            <el-form-item label="课程" prop="clazzId" label-width="100px">
              <el-tag size="medium" style="width:100px">{{courseName1}}</el-tag>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col span="12">
            <el-form-item label="电话" prop="phone" label-width="100px">
              <el-input
                v-model="form.phone"
                placeholder="请输入电话"
                :disabled="true"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      </div>
    </el-card>

  </div>
</template>

<script>
import request from '../../utils/request';
export default {
  name: "List",
  data() {
    return {
        form:{},
        user:{},
        g1:'',
        clazzName:"",
        courseName:"",
        gradeName1:'',
        clazzName1:"",
        courseName1:"",
    };
  },
  computed(){

  },
  created(){
      let str = sessionStorage.getItem("user") || "{}"
    this.user = JSON.parse(str)
    console.log(this.user);
    this.load()
  },
  methods:{
     load() {
      request
        .get("/teacher/page", {
          params: {
            PageNum: 1,
            PageSize: 10,
            search: this.user.name,
          },
        })
        .then((res) => {
          console.log(res.data.records[0].clazzList[0].gradeList.name);
          this.form = res.data.records[0];
          this.clazzName =res.data.records[0].clazzList[0].name
          this.g1 =res.data.records[0].clazzList[0].gradeList.name
          this.courseName =res.data.records[0].clazzList[0].gradeList.courseList[0].name
          this.clazzName1 =res.data.records[0].clazzList[1].name
          this.gradeName1 =res.data.records[0].clazzList[1].gradeList.name
          this.courseName1 =res.data.records[0].clazzList[1].gradeList.courseList[0].name
        });
    },
  }
};
</script>

